package com.ykq.product;

public class Rectangle {
    private float leftX;
    private float leftY;
    private float rightX;
    private float rightY;

    public float getLeftX() {
        return leftX;
    }

    public void setLeftX(float leftX) {
        this.leftX = leftX;
    }

    public float getLeftY() {
        return leftY;
    }

    public void setLeftY(float leftY) {
        this.leftY = leftY;
    }

    public float getRightX() {
        return rightX;
    }

    public void setRightX(float rightX) {
        this.rightX = rightX;
    }

    public float getRightY() {
        return rightY;
    }

    public void setRightY(float rightY) {
        this.rightY = rightY;
    }

    private static Rectangle rectangle=new Rectangle();
    private Rectangle(){

    }
    public static Rectangle getInstance(){
        return rectangle;
    }
    public boolean overlap(Rectangle rect){
        if(Math.abs(this.leftX-rect.getLeftX())>Math.abs(this.rightX-leftX)||Math.abs(this.leftY-rect.getLeftY())>Math.abs(this.rightY-leftY) ){
            return false;
        }
        return true;
    }
}
